package com.zzvcom.webapp.action.web;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zzvcom.persist.model.admin.Gallery;
import com.zzvcom.service.admin.GalleryManager;

@Controller
@Scope("prototype")
public class GalleryViewAction
{

	private GalleryManager manager;
	List<Gallery> gs = new ArrayList<Gallery>();

	@SuppressWarnings("unchecked")
	public String execute()
	{
		DetachedCriteria dc=DetachedCriteria.forClass(Gallery.class);
		dc.addOrder(Order.desc("seq"));
		gs = manager.getListByDetachedCriteria(dc);
		return "gallery";
	}

	public GalleryManager getManager()
	{
		return manager;
	}

	@Autowired
	public void setManager(GalleryManager manager)
	{
		this.manager = manager;
	}

	public List<Gallery> getGs()
	{
		return gs;
	}

	public void setGs(List<Gallery> gs)
	{
		this.gs = gs;
	}

}
